# Makefile for TPIE library.
# Use GNU make on this Makefile. It relies on the default rules.
# Use (GNU) "make -p" to see the default rules.
# $Id: Makefile.in,v 1.39 2003/10/09 01:46:11 tavi Exp $

ARFLAGS = rv
CXX = @CXX@
MAKEDEPEND = @CXX@ -M
RANLIB = @RANLIB@

# The directory containing the library header files.
TPIEINC = ../../include
# The name of the library.
LIBRARY = libtpie.a

# CPPFLAGS is used by the default rules. Using "override" and "+="
# allows the user to prepend things to CPPFLAGS on the command line.
override CPPFLAGS += -DTPIE_LIBRARY -I$(TPIEINC)
# These options are set by the configure script.
override CPPFLAGS += @DEFS@
# These options are for large file support. They force all file access
# calls to use the 64 bit variants. Several types change also, e.g. off_t
# becomes off64_t.
override CPPFLAGS += -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE

ifeq ($(MINUSG),1)
override CPPFLAGS += -g
else
override CPPFLAGS += -O3 # -DNDEBUG 
endif

ifeq ($(MINUSPG),1)
override CPPFLAGS += -pg
endif

# All sources must be listed here.
SRC =	logstream.cpp \
	tpie_log.cpp \
	mm_register.cpp \
	ami_device.cpp \
	ami_stream_single.cpp \
	mm_base.cpp \
	bte_stream_base.cpp \
	bit.cpp \
	bit_matrix.cpp \
	ami_matrix_blocks.cpp \
	ami_bit_permute.cpp \
	cpu_timer.cpp \
	ami_key.cpp \
	tpie_tempnam.cpp

OBJ =	$(SRC:.cpp=.o)

LIB_COMPONENTS = $(patsubst %.cpp,$(LIBRARY)(%.o),$(SRC))

(%): %
	$(AR) $(ARFLAGS) $@ $<

# Public targets.

all : $(LIBRARY)

depend: cleandepend 
	$(MAKEDEPEND) $(CPPFLAGS) $(SRC) >> Makefile.depend

clean: cleandepend
	-rm -f $(OBJ) $(LIBRARY)

distclean: clean

# Private targets.

cleandepend:
	-rm -f Makefile.depend

$(LIBRARY): $(LIB_COMPONENTS)

Makefile.depend: #$(SRC)
	rm -f Makefile.depend; \
	$(MAKEDEPEND) $(CPPFLAGS) $(SRC) >> Makefile.depend

include Makefile.depend

.PHONY : clean all depend cleandepend
